import React from 'react'

//优化
const Login = React.lazy(() => import('../view/Login'))
const Main = React.lazy(() => import('../view/Main'))
const Index = React.lazy(() => import('../view/main/Index'))
const Classify = React.lazy(() => import('../view/main/Classify'))
const Message = React.lazy(() => import('../view/main/Message'))
const My = React.lazy(() => import('../view/main/My'))
const Myprofile = React.lazy(() => import('../view/main/Myprofile'))
const ModifyPicture = React.lazy(() => import('../view/main/ModifyPicture'))
const ModifyName = React.lazy(() => import('../view/main/ModifyName'))
const ModifyPhone = React.lazy(() => import('../view/main/ModifyPhone'))
const Search = React.lazy(() => import('../view/search'))
const SearchDetail = React.lazy(() => import('../view/SearchDetail'))
const MyDetail = React.lazy(() => import('../view/MyDetail'))
const ArticleDetail = React.lazy(() => import('../view/ArticleDetail'))

// import Login from '../view/Login'
// import Main from '../view/Main'
// import Index from '../view/main/Index'
// import Classify from '../view/main/Classify'
// import Message from '../view/main/Message'
// import My from '../view/main/My'
// import Myprofile from '../view/main/Myprofile'
// import ModifyPicture from '../view/main/ModifyPicture'
// import ModifyName from '../view/main/ModifyName'
// import ModifyPhone from '../view/main/ModifyPhone'
// import Search from '../view/search'
// import SearchDetail from '../view/SearchDetail'
// import MyDetail from '../view/MyDetail'
// import ArticleDetail from '../view/ArticleDetail';
const routes = [
  {
    path: "/login",
    component:Login
  },
  {
    path: "/search",
    component:Search
  },
  {
    path: "/searchDetail",
    component:SearchDetail
  },
  {
    path: "/mydetail",
    component:MyDetail
  },
  {
    path: '/articleDetail',
    component: ArticleDetail
  },
  {
    path: "/main",
    component: Main,
    children: [
      {
        path: "/main/index",
        component:Index
      },
      {
        path: "/main/classify",
        component:Classify
      },
      {
        path: "/main/message",
        component:Message
      },
      {
        path: "/main/my",
        component: My,
      },
      {
        path: "/main/myprofile",
        component:Myprofile
      },
      {
        path: "/main/modifypicture",
        component:ModifyPicture
      },
      {
        path: "/main/modifyname",
        component:ModifyName
      },
      {
        path: "/main/modifyphone",
        component:ModifyPhone
      },
      {
        path: "/main",
        redirect:"/main/index"
      },
    ]
  },
  {
    path: "/",
    redirect:"/main"
  }
]
export default routes